package com.qzdsoft.erpcloud.service.act.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.qzdsoft.erpcloud.domain.act.CenterSmsLog;
import com.qzdsoft.erpcloud.mapper.act.CenterSmsLogInfoMapper;
import com.qzdsoft.erpcloud.mapper.act.CenterSmsLogMapper;
import com.qzdsoft.erpcloud.service.act.CenterSmsLogService;
import com.qzdsoft.erpcloud.vo.query.act.CenterSmsLogInfo;
import com.qzdsoft.erpcloud.vo.query.act.CenterSmsLogQueryParam;
import com.qzdsoft.vo.LayTableResponse;
import com.qzdsoft.vo.Response;
import com.qzdsoft.vo.ResultEnum;

/**
 * Created by Yang
 */
@Service
public class CenterSmsLogServiceImpl implements  CenterSmsLogService  {

    @Autowired
    private CenterSmsLogMapper actCenterSmsLogMapper;
    
    @Autowired
    private CenterSmsLogInfoMapper centerSmsLogInfoMapper;
    
    @Override
    public CenterSmsLog selectById(Integer id) {
        return actCenterSmsLogMapper.selectByPrimaryKey(id);
    }

    @Override
    public Response<String> saveOrUpd(CenterSmsLog actCenterSmsLog) {
        if(null != actCenterSmsLog.getId()){
            actCenterSmsLogMapper.updateByPrimaryKey(actCenterSmsLog);
        } else {
            actCenterSmsLogMapper.insert(actCenterSmsLog);
        }
        return new Response<String>(ResultEnum.SUCCESS);
    }

    @Override
    public Response<String> del(Integer id) {
        actCenterSmsLogMapper.deleteByPrimaryKey(id);
        return new Response<String>(ResultEnum.SUCCESS);
    }


    @Override
    public LayTableResponse<CenterSmsLogInfo> selectData(CenterSmsLogQueryParam centerSmsLogQueryParam)
    {
        PageHelper.startPage(centerSmsLogQueryParam.getPage(), centerSmsLogQueryParam.getLimit());
        List<CenterSmsLogInfo> list = centerSmsLogInfoMapper.selectData(centerSmsLogQueryParam);
        return new LayTableResponse<CenterSmsLogInfo>(list);
    }

    @Override
    public Integer selectDataCount(
            CenterSmsLogQueryParam centerSmsLogQueryParam)
    {
        // TODO Auto-generated method stub
        return null;
    }


}
